import { GetSimilarSong, GetSimilarMove } from "apis/index";
Component({
  options: {
    styleIsolation: "apply-shared",
  },
  properties: {
    id: {
      type: String,
    },
  },

  data: {
    songs: [],
    moves: [],
  },
  // observers: {
  //   id(newVal) {},
  // },
  attached() {
    this.init();
  },
  // lifetimes: {
  //   show() {},
  // },
  methods: {
    //初始化
    init(id = "1808492017") {
      if (!id) {
        showTaost("缺少id参数");
        return;
      }
      this.getSimiSongs(id);
      this.GetSimilarMove(id);
    },
    //获取相似歌曲
    getSimiSongs(id) {
      GetSimilarSong({ id }).then((res) => {
        this.setData({
          songs: res.songs || [],
        });
      });
    },
    //获取相似Move
    GetSimilarMove(mvid) {
      GetSimilarMove({ mvid }).then((res) => {
        this.setData({
          moves: res.mvs || [],
        });
      });
    },
  },
});
